import * as actionType from "../types/home";
import * as API from "../../utils/homeUrl"
import {RES_OK_CODE} from "../types/index" 
import {post} from "../../utils/url"


// export function getSiteInfo(params) {
//   return (dispatch, getState) => {
//     post(API.getSiteInfo())
//     .then(res => res.json())
//     .then(data => {
//         dispatch({
//           type: actionType.REQUEST_BANNER_LIST,
//           data
//         })
//     })
//   }
// }

export function getSiteInfo(params) {
  return (dispatch, getState) => {
    post(API.getSiteInfo())
    .then(res => res.json())
    .then(data => {
        dispatch({
          type: actionType.REQUEST_SYSTEM_MESSAGE_ALL,
          data
        })
    })
  }
}

export function getSystemMessage(params) {
  return (dispatch, getState) => {
    post(API.getSystemMessageAPI())
    .then(res => res.json())
    .then(data => {
        dispatch({
          type: actionType.REQUEST_SYSTEM_MESSAGE,
          data
        })
    })
  }
}

export function getWinningList(params) {
  return (dispatch, getState) => {
    post(API.getwinningListAPI())
    .then(res => res.json())
    .then(data => {
        dispatch({
          type: actionType.REQUEST_WINNING_LIST,
          data
        })
    })
  }
}


export function loadPlayGameList(){
  return (dispatch, getState) => {
    post(API.loadPlayGameListAPI())
    .then(res => res.json())
    .then(data => {
        dispatch({
          type: actionType.REQUEST_PLAY_GAME_LIST,
          data: data
        });
    });
  };
}